package cn.com.dingtek.genius.manager.server.support;

import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

@Getter
public enum DeviceSocket {
    /**
     *
     */
    NB_IOT(1, "NB-IoT"),
    LO_RA_WAN(2, "LoRaWAN"),
    GPRS(3, "GPRS"),
    WCDMA(4, "WCDMA");

    private int value;
    private String desc;

    DeviceSocket(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static Optional<DeviceSocket> valueOf(Integer value) {
        return Arrays.stream(DeviceSocket.values())
                .filter(item -> item.getValue() == value)
                .findFirst();
    }

    @Override
    public String toString() {
        return desc;
    }
}
